package com.icef0x.tools;

import java.io.IOException;
import java.net.URI;

import javax.tools.SimpleJavaFileObject;

/**
 * @author ywang
 */
public class JavaSourceFile extends SimpleJavaFileObject {

    private String content;
    
    public JavaSourceFile(String name, String content) {
        super(URI.create("string:///" + name.replace(".", "/") + Kind.SOURCE.extension), Kind.SOURCE);
        this.content = content;
    }
    
    @Override
    public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
        return content;
    }
}
